1. Field of the Invention
The invention relates in general to video coding, and in particular, to a transcoding method in video coding.
2. Description of the Related Art
Variable length coding (VLC) is commonly used in digital video compression, mapping source symbols to a variable number of bits. Video compression is typically carried out on a basis of a block, i.e., a group of pixels, e.g., 16×16, 16×8, 8×16, or 8×8 block. The compression scheme typically involves performing a transform function such as the discrete cosine transform (DCT) on a block to generate block coefficients, then quantizing the resultant block coefficients, scanning the quantized coefficients along a predefined order in the block to form a series of coefficients, and then statistically encoding the series of block coefficients using the VLC to generate VLC codewords for data transmission.
The series of block coefficients are grouped by a run of preceding zero amplitude coefficients, followed by a non-zero amplitude coefficient, wherein each group is referred to as a symbol. The symbols are statistically encoded using a variable length code such that the most frequently occurring symbol is encoded with the shortest codeword, and the less frequently occurring symbols are encoded with the longer codewords. For even less frequently occurring symbols, fixed-length codewords are deployed, and an escape code is attached at the beginning of each codeword to indicate the fixed-length codeword.
In video coding standards such as H.263, each symbol comprises 3 parameters for VLC generation, including LAST, a binary flag indicating whether or not the current symbol comprises the last non-zero coefficient in the block, RUN, a run-length of zero coefficients that precedes the current non-zero coefficient, and LEVEL, the current non-zero coefficient amplitude value. FIG. 1 shows a table used to generate the VLC codewords by the LAST, RUN, and LEVEL parameters. The video encoder receives a symbol comprising the LAST, RUN, and LEVEL parameters to look up the table of FIG. 1 to generate a variable number of run-length bitstream. The table shown in FIG. 1 comprises a number of lookup tables, each lookup table 10, 12, or 14 is indexed by LAST parameter, the video encoder finds a corresponding lookup table according to LAST parameter, and determines corresponding run-length codeword according to LEVEL and RUN parameters.
A number of video coding standards, such as the H.263 standard, have been specified and related video coding standards, such as the Sorenson H.263 by Sorenson and RMv2 by RealMedia, have been developed. Transcoding the video data from one format to another provides flexibility and reduces implementation costs as software or hardware of the video encoder for the different standards may be shared.